package github.kawaiior.botapiserver.controller;

import github.kawaiior.botapiserver.common.ActionResponse;
import github.kawaiior.botapiserver.service.BotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/bot")
public class BotController {

    @Autowired
    private BotService botService;

    @RequestMapping("/init")
    public ActionResponse initBot(String bot_id, String name, String intro){
        return botService.initBot(bot_id, name, intro);
    }

    @RequestMapping("/init_group")
    public ActionResponse initBotGroup(String bot_id, String group_id, String name){
        return botService.initBotGroup(bot_id, group_id, name);
    }

    @RequestMapping("/init_user")
    public ActionResponse initGroupUser(String bot_id, String group_id, String user_id, String name){
        return botService.initGroupUser(bot_id, group_id, user_id, name);
    }

    @RequestMapping("/info")
    public ActionResponse getInfo(String bot_id){
        return botService.getInfo(bot_id);
    }

    @RequestMapping("/access")
    public ActionResponse checkAccess(String bot_id, String group_id, String user_id, String ip){
        return botService.checkAccess(bot_id, group_id, user_id, ip);
    }

}
